Return to doc.sitecore.com

System.Data.SqlClient.SqlException exception
Prev Next

Author: 
Posted: 8/7/2007 12:00:00 PM

Q: I get an exception System.Data.SqlClient.SqlException: String or binary data would be truncated. What is the reason? Is there any fix or workaround for this?

A: The matter is that in previous versions of Sitecore the list of referred items in Link database was limited by 4000 symbols. The type of TargetPath field was nvarchar(4000). However often there is many links from one item to another. The example is multilist control or treelist. Thos could be easily fixed if TargetPath field type will be changed to ntext. To perform this you may apply following script:

USE [SC53ARCHIVE]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

USE [SC53CORE]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

USE [SC53EXTRANET]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

USE [SC53MASTER]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

USE [SC53RECYCLEBIN]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

USE [SC53SECURITY]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

USE [SC53WEB]

ALTER TABLE dbo.Links

ALTER COLUMN [TargetPath] ntext NOT NULL

Also you can manually change TargetPath field type in each of your database in Links table from nvarchar(4000) to ntext.

After this you should perform rebuilding of Links database for all databases via ControlPanel/Databases/Rebuild the link Database.


Prev Next